<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>添加图书</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 20px;
            background-color: #f7f7f7;
        }

        .container {
            max-width: 600px;
            margin: 0 auto;
            background: #fff;
            padding: 20px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            border-radius: 8px;
        }

        .personal-info {
            position: fixed;
            bottom: 20px;
            right: 20px;
            font-size: 14px;
            color: #555;
        }

        h1 {
            text-align: center;
            color: #333;
        }

        form {
            display: flex;
            flex-direction: column;
        }

        .form-group {
            margin-bottom: 15px;
        }

        .form-group label {
            font-weight: bold;
            margin-bottom: 5px;
        }

        .form-group input {
            width: 100%;
            padding: 10px;
            border: 1px solid #ccc;
            border-radius: 4px;
            box-sizing: border-box;
        }

        .form-group input:focus {
            border-color: #80bdff;
            outline: 0;
            box-shadow: 0 0 0 .2rem rgba(0,123,255,.25);
        }

        button {
            width: 100%;
            padding: 10px;
            background-color: #007bff;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 16px;
        }

        button:hover {
            background-color: #0056b3;
        }

        .back-link {
            text-align: center;
            display: block;
            margin-top: 20px;
            color: #007bff;
            text-decoration: none;
            font-size: 16px;
        }

        .back-link:hover {
            text-decoration: underline;
        }
    </style>
</head>
<body>

<div class="personal-info">
    <p>谭星 202235020333</p>
</div>

<div class="container">
    <h1 th:text="${book.id} != null ? '编辑图书' : '添加图书'"></h1>
    <form th:action="@{/books/save}" th:object="${book}" method="post">
        <input type="hidden" th:field="*{id}" />
        <div class="form-group">
            <label for="bookName">书名:</label>
            <input type="text" th:field="*{name}" id="bookName" />
        </div>
        <div class="form-group">
            <label for="bookAuthor">作者:</label>
            <input type="text" th:field="*{author}" id="bookAuthor" />
        </div>
        <div class="form-group">
            <label for="bookPress">出版社:</label>
            <input type="text" th:field="*{press}" id="bookPress" />
        </div>
        <div class="form-group">
            <label for="bookStatus">状态:</label>
            <input type="text" th:field="*{status}" id="bookStatus" />
        </div>
        <button type="submit">保存</button>
    </form>
    <a href="/books" class="back-link">返回图书列表</a>
</div>

</body>
</html>